#!/usr/bin/env node


const http = require('http'),
      qs = require('querystring');


http.createServer((req,res) => {
   console.log(`响应起始行：HTTP/${req.httpVersion} ${req.statusCode} ${req.statusMessage}`)
   console.log(req.headers);
   console.log();
   if(req.method === 'GET'){
     res.end('ok');
   }
   let data = '';
   req.on('data',chunk => {
      data += chunk;
   })
   req.on('end',() => {
      qs.parse(data);
      res.end('ok');
   })
}).listen(3000);
